//
//  CJRECMainModel.m
//  CoJellyCartoon
//
//  Created by dllo on 16/3/30.
//  Copyright © 2016年 CJG. All rights reserved.
//

#import "CJRECMainModel.h"

@interface CJRECMainModel ()

@property (nonatomic, strong) NSMutableArray *dataArray;

@end

@implementation CJRECMainModel

- (instancetype)initWithDictionary : (NSDictionary *)datasource
{
    self = [super init];
    
    [self setValuesForKeysWithDictionary:datasource];
    
    if (self) {
        self.dataArray = [NSMutableArray arrayWithCapacity:0];
        
        for (NSDictionary *dic in self.body) {
            CJRECInBodyModel *recinbodymodel = [[CJRECInBodyModel alloc] init];
            [recinbodymodel setValuesForKeysWithDictionary:dic];
            [self.dataArray addObject:recinbodymodel];
        }
        self.body = [NSArray arrayWithArray:self.dataArray];
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if ([key isEqual:@"head"]) {
        
        self.recHead = [[CJRECHeadModel alloc] init];
        [self.recHead setValuesForKeysWithDictionary:value];
    }
}
@end
